home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 4
/
United Public Domain Gold 4.iso
/
fredfish
/
ff.0536.dms
/
ff.0536.adf
/
WFile
/
wfile.doc
< prev
next >
Wrap
Text File
|
1991-09-03
|
19KB
|
364 lines
WFILE 1.10
WorkFILE - process ASCII-files
Amiga Version
(C) 1991 Joerg Fenin / Metalworx
------------------------------------------------------------
WFile is Freeware. That means it can be used and distributed
freely as long as the following rules are obeyed:
* WFile may not be part of a commercial product without the
written permission of the author.
* WFile may not be distributed on (public domain-, shareware-,
freeware-) disks if more than DM 5,- / US $ 5,- is charged as
copying and/or distribution fee for that disk. (exception:
Fred Fish, he may charge more).
* The copyright message must remain UNCHANGED!
* WFile MUST NEVER be distributed on own disk series of Stefan
Ossowski PD-Versand, Rainer Wolf PD-Versand, Markt & Technik
AG, Karstadt AG.
USE THIS PROGRAM AT YOUR OWN RISK!!
There is no guarantee that WFile works properly. The author takes
no responsibility for any damage that might result from the use of
WFile.
------------------------------------------------------------
1
Purpose
Do you often interchange ASCII files between the Amgia, a PC or
UNIX systems ? Do you look for a possibility to expand TABs in
ASCII files to SPACES or vice versa ? Do you want to extinguish
certain characters from ASCII files ?
If the answers were YES, you may have some advantages in using
WFile, if the answers were NO, you can leave here and try out some
other program on this disk.
WFile should make it easy for you to interchange ASCII files
between different computer systems (such as Amiga, PC or UNIX
systems). It does all character converting (foreign symbols etc)
and NEWLINE conversion for you.
WFile can also be used to expand TAB-codes (0x09) into any number
(2 - 8 usually) of SPACE-codes (0x20) or vice versa, or you can
delete certain characters from your ASCII files (such as formfeeds
(0x0c) for example).
WFile stands for 'work file', that means do specific things on
(ASCII) files.
2
Capabilities
WFile can do the following things for you:
* Expand TABs to multiple spaces
* Shrink multiple spaces to one TAB
* Change foreign symbols to different (machines') character
sets
* Add or strip carriage return codes (0x0d) from the end of
each line
* Online help screens
* Built-in templates for easy file interchange between Amiga,
PC and UNIX
* Profiles for default settings.
3
Usage
WFile has no (actually not yet) intuition interface, it has to be
invoked from a CLI or shell. If you simply type
wfile
you will get the following template:
wfile 1.11/6 - 12-Aug-91 (C) 1991 Metalworx
Usage:wfile < file| -? > [<+|->CR] [<+|->T[size]] [-ddd=ddd
[...] [-0]] [-b] [-f[file]] [-AI] [-IA] [-AU] [-UA]
[-UI] [-IU] [+ddd]
Parameters in <>-brackets
must
be specfied, those in []-brackets
are optional. If a | (straight slash) stands between parameters
exactly ONE of these parameters has to be specified. Example:
[<+|->CR]
||||||| |
||||||| |--------------- end of optional parameter
|||||||
||||||------------------ command, see below
||||||
|||||------------------- end of unconditional parameter
|||||
||||-------------------- command introduction #2
||||
|||--------------------- command introduction seperator, use
||| either command introduction #1 (+) or
||| command introduction #2 (-)
|||
||---------------------- command introduction #1
||
|----------------------- beginning of unconditional parameter
|
------------------------ beginning of optional parameter
or literally: If you decide to use command CR, which is just up to
you, then you have to give either +CR or -CR, not just CR and not
+-CR.
WFile needs at least one argument, the name of the file that is to
be processed. If you don't specify anything else, WFile just reads
the file, creates a backup file of it (by appending .bak to the
filename, see below) and writes the file back to disk
unchanged
.
3.1
Commands
-? invokes builtin help function.
Therefore on Amiga systems the file wfile.hlp has to be
located in the same directory as wfile. On other systems
(MSDOS and UNIX) it has to exist in the current
directory.
The Amiga version automatically calculates the number of
lines for each page from the current, active window.
After displaying this amount of lines, WFile waits for
the RETURN key to be pressed. On other systems this line
count is static and may be changed in the file wfile.h
If you are familiar in using WFile you can delete the
help file. Of course you can't invoke the help fuction
then!
-|+CR strips or adds CR codes ($0d) to the end of each line.
On Amiga and UNIX machines, the end of a text line is
represented with a single newline character ($0a), on
MSDOS based machines therefore two characters are needed
($0d$0a, carriage return (CR), linefeed).
If you specify -CR all CR codes will be stripped off.
Use this option if you convert text files from MSDOS to
the Amiga or to UNIX.
Use +CR to convert it the other way round.
-|+T[tabsize] In some text editors, such as vi, MicroEmacs or the
TurboC editor you can change the size of a tab.
Usually a tab consists of eight spaces, but for a C
programmer this value often is too big, if you use
many ifs, fors and whiles. So most of the
programmers set the tabsize to 2, which is a
convenient value. The above editors then still use
tabcodes but expand them within their own
environment to just two spaces, no matter what the
outside world say! If you then load up this file
with a 'clever' editor, such as dme, tabs appear
again as eight spaces. To convert files between
'clever' editors and 'dumb' ones (no offense,
really, they got other advantages, at least I think
so... :-) you can use this command.
-T exchanges tabcodes against multiple spaces. You
can enter the number of spaces by specifing the
optional tabsize parameter right after the 'T',
e.g. -T2, this will expand one tab code ($09) to
two spaces ($20). If you don't specify the tabsize,
WFILE assumes a value of eight.
+T shrinks multiple spaces into one tab. The
tabsize parameter serves as a maximum value. This
is a bit complicated: If you say for example +T5 a
tabstop will be set every fifth column in a file
(column 0, 5, 10, 15...). This means, that at
maximum 5 spaces will be converted into on tab,
saving you 4 bytes. But it might be possible, that
the first three columns are filled up with text:
Column: 01234567890
/** Text
| | |
| | ----- following text
| |
| ------- two spaces
|
---------- beginning of line
In this and in similar cases just two spaces will
be converted into one tabcode, setting the
textcounter up to the next tabstop. In my language
I would call this a fixed tab. As far as I know,
all text editors and word processors use this
system of handling tabs. However the source code is
provided for those who wish to change this (but I
wouldn't dare, this part of the code is very
cryptic I must say!).
-ddd=ddd change decimal values.
With this powerful option you can change any character
of your file into another. This gives you the possibilty
of transfering files from one system to another without
having to fix all the special characters (like the
German Umlaute etc.) on the new system. We in Germany
have a letter that is made of an o and an e together. We
call this an "ö" (<- probably not displayed, if you use
different keymaps). This letter has the ASCII value 246.
On MSDOS systems it has the ASCII value 148. To convert
all these letters automatically you just have to say
-246=148.
You can alse remove all these letters if you say
-246=0. In this case all oes will be removed.
If you would like to exchange the oe against a \0 you
have to specify -0 as an additional option (see below).
This tells WFile to treat the 0 as decimal value, not as
a remove command.
In this release you have to use decimal ASCII values. I
plan to allow the use of hexadecimal and octal numbers.
-0 treat 0 as an ASCII value
As default the 0 will act like a remove command. If you
say for example -246=0, each letter with the ASCII value
246 will be removed. If you say -246=0 -0, then all
letters with ASCII value 246 will be exchanged by '\0'
characters. I didn't use this myself, but may be there
is a situation where it might be needed.
-b do not create backup file.
By default WFile creates a backup of the original file,
just in case anything goes wrong. On Amiga and UNIX
systems .bak will be appended to the filename, on MSDOS
machines the file's extension will be changed to .bak.
With -b you can suppress the creation of the backup
file, for example if you don't have space on your disk.
-f[filename] read profile with WFile commands.
Yet another very powerful option. You can stack
multiple commands in a file that may be processed
when invoking WFile. This gives you the possibilty
to create several profiles for different tasks, for
example one profile to handle conversion between
MSDOS and Amiga, another on to handle the opposite
(though there are also bultin templates for these
special cases, see below). If you don't specify a
filename the file wfile.pro will be loaded, if it
exists. See below for information on how to build a
profile.
-AI Amiga to IBM conversion template
This template changes foreign symbols (German Umlaute in
the current version) from the Amiga to the enhanced
IBM-ASCII set used in IBM PCs and its clones. It also
adds an CR code to the end of each line and removes the
end-of-file character ($1a).
-IA IBM to Amiga conversion template
This templete changes foreign symbols (German Umlaute in
the current version) from the enhanced IBM-ASCII set to
MSDOS compatible systems to the character set of the
Amiga. The CR code at the ende of each line will be
stripped, an end-of-file character ($1a) will be
appended to the file.
-AU Amiga to UNIX conversion template
changes Amiga foreign symbols to their UNIX (HP 9000/825
HP-UX 7.0 SysV) equivalents (see above).
-UA UNIX to Amiga conversion template
changes UNIX (HP 9000/825 HP-UX 7.0 SysV) foreign
symbols to their Amiga equivalents (see above).
-UI UNIX to IBM conversion template
changes foreign symbols from UNIX to the enhanced
IBM- ASCII set used in IBM PCs and its clones. It
also adds an CR code to the end of each line. An end-of-
file character ($1a) will be appended to the file.
-IU IBM to UNIX conversion templete
changes foreign symbols from the enhanced IBM-ASCII
set on MSDOS compatible systems their equivalents in
UNIX.The CR code at the end of each line will be
stripped, the end-of-file-code will be deleted.
+ddd append character at end of file.
On MSDOS systems all files end with a special end-of-
file character ($1a). UNIX and Amiga systems don't need
these characters. To add such character you can specify
+26 as an option and a character with the ASCII value 26
($1a) will be appended at the end of the file
3.2
Templates
WFile has currently six builtin templates (see above) for easy
text interchange between Amiga, MSDOS and UNIX systems. Whenever
you specify a template as an option to WFile, all its commands
will be printed to SDTOUT, to let you see what is going on.
3.3
Profiles
Generally: All options within a profile are written to STDOUT to
let you see what's going on.
In a profile you can specify the options that WFile should use.
You can keep any number of profiles, according to your needs. If
you want to use a profile you must specify the -f option (see
above) to let WFile know your commands come from a file. If no
filename after the -f option is specified, WFile looks for a file
named 'wfile.pro' in the current directory to read from.
A profile can contain any number of options as long as the general
maximum for WFile commands is not exceeded. All templates (see
above) may be used!
You should not specify the options within a template also by
yourself. WFile might get confused if an option has to be
processed twice.
Each option must stand in a single line. Each line MUST NOT
contain more than 79 characters (currently there is no option,
that is that long). Each line MUST end with a newline character
($0a on UNIX and Amiga, $0d$0a on MSDOS). Comment lines MUST have
a # character as their first sign.
Example:
# don't enter the <newline> literally, just press return
-t2 <newline>
-UI <newline>
-b <newline>
4
Technical information
WFile was written in C and has been compiled, optimized for time
and made resident with the SAS/Lattice C Compiler 5.10a. See the
source readme file for information concerning the source code. It
does not need any libraries, handlers or devices.
Files are read in in one piece, usually the allocated space will
be 2-3 times larger than the orignal file. This limits the file
size of the worked file. In a future release I will include an
option, that reads in a file part by part.
I work with a stack frame of 4000 bytes, actually I think it can
be lower, WFile does not work recursivley.
The number of change options (-ddd=ddd) is limited to 26, that is
because the alphabet consists of 26 characters, and I don't think
that more changes are needed. If there is a need, well, change the
source code and recompile. The total number of options must be
below 100, this really should do, by the way, all options in a
template count!
5
Future directions
There are certain things I'd like to do in future versions:
- split option, option that splits read-in of files in small
parts, so that even large files can be handled
- Intuition based user interface
- expand templates to handle ALL characters
*****************************************************************
last manual update: 08 13,1991